package com.laf.manager.controller.dto;

import com.laf.manager.dto.PointsDeduction;
import lombok.Data;
import org.springframework.jdbc.core.RowMapper;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

/**
 * @author ygl
 * @create 2019-01-03
 * @DESCRIPTION
 **/
@Data
public class PointsDeductionDto implements RowMapper<PointsDeductionDto>, Serializable {
    /**
     * 会员姓名
     */
    private String memberName;

    private int id;

    /**
     * 抵扣编号
     */
    private String offsetNumber;
    /**
     * 会员ID
     */
    private int memberId;
    /**
     * 车牌号
     */
    private String carNumber;
    /**
     * 总金额
     */
    private double totalCost;
    /**
     * 抵扣金额
     */
    private int deductionCost;
    /**
     * 抵扣积分
     */
    private int deductionPoints;
    /**
     * 状态:1:冻结。2：实扣。3：撤销
     */
    private int status;
    /**
     * 冻结时间
     */
    private Date frozenDate;
    /**
     * 实扣／撤销时间
     */
    private Date bizDate;


    @Override
    public PointsDeductionDto mapRow(ResultSet rs, int rowNum) throws SQLException {
        PointsDeductionDto model = new PointsDeductionDto();
        model.setId(rs.getInt("id"));
        model.setOffsetNumber(rs.getString("offset_number"));
        model.setMemberId(rs.getInt("member_id"));
        model.setCarNumber(rs.getString("car_number"));
        model.setTotalCost(rs.getDouble("total_cost"));
        model.setDeductionCost(rs.getInt("deduction_cost"));
        model.setDeductionPoints(rs.getInt("deduction_points"));
        model.setStatus(rs.getInt("status"));
        model.setFrozenDate(rs.getTimestamp("frozen_date"));
        model.setBizDate(rs.getTimestamp("biz_date"));
        model.setMemberName(rs.getString("member_name"));
        return model;
    }
}
